//
//  DYYuyinJIangjieSubCell.swift
//  SheYangBigData
//
//  Created by 宋海胜 on 2021/1/4.
//  Copyright © 2021 叁拾叁. All rights reserved.
//


import UIKit
import YYText

class DYYuyinJIangjieSubCell: SYBaseCell {
    
    let nameLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x1E1E1E)
        v.font = 15.autoFontSize()
        
        return v
    }()
    
    let tagLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x666666)
        v.font = 13.autoFontSize()
        return v
    }()
    
    let pingjiaLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x00C793)
        v.font = 11.autoFontSize()
        v.backgroundColor = UIColor(hex: 0xDBF7F0)
        return v
    }()

    let jiangjieIcon: UIImageView = {
        let v: UIImageView = UIImageView()
        v.sy_name("erduo")
        v.layer.cornerRadius = 3
        return v
    }()
    
    let pic: UIImageView = {
        let v: UIImageView = UIImageView()
        
        v.layer.cornerRadius = 3
        return v
    }()
    
    let play: UIImageView = {
        let v: UIImageView = UIImageView()
        v.sy_name("jiangjie_wifi")
        v.isHidden = true
        return v
    }()

    public func configureView(_ model: DYTourScenicExplainVOModel) {
        nameLb.text = model.name
        pingjiaLb.text = " \(model.label ?? "") "
        tagLb.text = "\(model.useNum)"
        pic.sy_setWithUrl(model.imgUrl)
    }
    
    override func initViews() {
        
        addSubview(nameLb)
        addSubview(tagLb)
        addSubview(pingjiaLb)
        addSubview(pic)
        pic.addSubview(play)
        addSubview(jiangjieIcon)
        nameLb.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(16.0.autoWidth())
            make.left.equalTo(pic.snp.right).offset(autoWidth(12.5))
            make.right.equalToSuperview().offset(autoWidth(-15.0))
            make.height.equalTo(14.5.autoWidth())
        }
        tagLb.snp.makeConstraints { (make) in
            make.centerY.equalTo(jiangjieIcon)
            make.height.equalTo(12.0.autoWidth())
            make.left.equalTo(jiangjieIcon.snp.right).offset(7.0.autoWidth())
        }
        pingjiaLb.snp.makeConstraints { (make) in
            make.top.equalTo(nameLb.snp.bottom).offset(autoWidth(9.5))
            make.left.equalTo(nameLb.snp.left)
            make.height.equalTo(15.0.autoWidth())
        }
        pic.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(15.0.autoWidth())
            make.left.equalToSuperview().offset(autoWidth(15.0))
            make.height.equalTo(85.0.autoWidth())
            make.width.equalTo(85.0.autoWidth())
            make.bottom.equalToSuperview().offset(-12.0.autoWidth())
        }
        play.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
        }
        jiangjieIcon.snp.makeConstraints { (make) in
            make.bottom.equalTo(pic).offset(-3.5.autoWidth())
            make.left.equalTo(pic.snp.right).offset(15.0.autoWidth())
            make.width.equalTo(7.5.autoWidth())
            make.height.equalTo(11.5.autoWidth())
        }
    }
}

